package message

import (
	bootstrap "github.com/asticode/go-astilectron-bootstrap"
	"go_gui_basic_binding/frame/appOptions"
	"go_gui_basic_binding/frame/log"
)

// 发送信息
func SendMessage(name ,payload string,windowName ...string) {
	windows := appOptions.W
	if len(windowName) > 0 {
		windows = appOptions.Cw[windowName[0]]
	}
	if err := bootstrap.SendMessage(windows, name, payload); err != nil {
		log.Error(err)
	}
}

// 接收普通消息处理
func MsgHandle(m bootstrap.MessageIn) interface{} {
	log.Log("测试普通消息" + m.Name)
	return nil
}